const express=require('express')

const app=express()

//拦截器(全局)
app.use('/',(req,res,next)=>{
    let {token}=req.query
    if(token){
        next()
    }else{
        res.send('缺少token')
    }
})
//拦截器(局部)
app.get('/text',(req,res,next)=>{
    console.log('fun1')
    next()

}, (req,res)=>{
    console.log(req.query)
    res.send('ok')
})

app.get('/text1',(req,res)=>{
    console.log(req.query)
    res.send('ok')
})

app.listen(8000,()=>{
    console.log('server starting')
})